package com.example.taxfloatproject20240926.ui.adapter;

import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.taxfloatproject20240926.R;
import com.example.taxfloatproject20240926.ui.bean.CallBean;

import java.util.ArrayList;
import java.util.List;


/**
 * Created by Administrator on 2018/12/22.
 */

public class QueueAdapter extends BaseAdapter {
    private Context context;
    private List<CallBean> queLists;

    public QueueAdapter(Context context, List<CallBean> queLists) {
        this.context = context;
        this.queLists = queLists;
    }

    public void setQueLists(List<CallBean> queLists) {
        this.queLists = queLists;
    }

    @Override
    public int getCount() {
        return queLists.size();
    }

    @Override
    public Object getItem(int i) {
        return queLists.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
       HoldView holdView = null;
        if (view == null) {
            holdView = new HoldView();
            view = View.inflate(context, R.layout.item_dialog, null);
            holdView.tv_queue_name = view.findViewById(R.id.tv_queue_name);
            view.setTag(holdView);
        } else {
            holdView = (HoldView) view.getTag();
        }
        holdView.tv_queue_name.setText(queLists.get(i).getCallInfo());
        if (i == 0) {
            holdView.tv_queue_name.setTextColor(Color.RED);
        } else {
            holdView.tv_queue_name.setTextColor(Color.WHITE);
        }
        return view;

    }


    class HoldView{
        private TextView tv_queue_name;
    }


}
